
//钱多钱少，开心到老。想清楚什么让自己得偿所愿，才是最应该做的事。
let birthday = {
    year:1993,
    month:9,
    day:19
}
function getliveDay(birthday){
    let olddate = new Date(birthday.year, birthday.month-1, birthday.day);
    let nowDate = new Date()
    let currenMax = nowDate - olddate
    console.log(currenMax)
    let nowDays = currenMax/1000/60/60/24
    console.log(nowDays)
}
getliveDay(birthday)
function setDeadline(num){
    let olddate = new Date(birthday.year, birthday.month-1, birthday.day)
    let deadyear = birthday.year+num
    let deadDate = new Date(deadyear,birthday.month,birthday.day)
    let nowDate = new Date()
    let deadDateTime= deadDate - nowDate
    let leftdate = deadDateTime/1000/60/60/24
    console.log(leftdate)
}
setDeadline(70)

function getLeftYear(birthday){
    let allNum = 70;
    let today = new Date()
    let currenYear = today.getFullYear()
    let hasLostyear = currenYear-birthday.year
    let leftYear = 70- hasLostyear
    return {
        allYear:70,
        hasLostyear:hasLostyear,
        leftYear:leftYear
    }
}
console.log(getLeftYear(birthday))

function getLeftMonth(birthday){
    let allMonth = 70*12;
    let nowDate = new Date()
    let olddate = new Date(birthday.year, birthday.month, birthday.day)
    let haslostMonth = (nowDate.getFullYear()-olddate.getFullYear())*12+nowDate.getMonth()+1
    let leftMonth = allMonth-haslostMonth
    return {
        allMonth:allMonth,
        haslostMonth:haslostMonth,
        leftMonth:leftMonth
    }
}
console.log(getLeftMonth(birthday))
// export default {
//     getliveDay: getliveDay,
//     setDeadline: setDeadline,
//     getLeftYear: getLeftYear,
//     getLeftMonth: getLeftMonth
//   }
